#include <memory>
#include "TcpServer.hpp"
#include "Protocol.hpp"
#include "Parser.hpp"
#include "Http.hpp"

int main(int argc, char *argv[])
{
    EnableConsoleLogStrategy(); // 启动日志
    std::unique_ptr<Http> ht = std::make_unique<Http>();
    std::unique_ptr<Parser> parser = std::make_unique<Parser>([&ht](HttpRequest& req)
    {
        return ht->Exec(req);
    });

    std::unique_ptr<TcpServer> tsvr = std::make_unique<TcpServer>([&parser](std::string& str)
    {
        return parser->Parse(str);
    });
    tsvr->Start();
    return 0;
}